package com.bjpowenode.java;


import org.junit.Test;

import java.util.Scanner;

/**
 * @author wuyuecai
 * @create 2021-05-29 20:02
 */
public class TestSwitch {
    @Test
    public void test() {
//            Scanner scanner = new Scanner(System.in);
//            int week = scanner.nextInt();
        int week = 3;
        switch (week) {
            case 1:
                System.out.println("今天周一");
                break;
            case 2:
                System.out.println("今天周二");
                break;
            case 3:
                System.out.println("今天周三");
                break;
            case 4:
                System.out.println("今天周四");
                break;
            case 5:
                System.out.println("今天周五");
                break;
            case 6:
                System.out.println("今天周六");
                break;
            case 7:
                System.out.println("今天周日");
                break;
            default:
                System.out.println("无效的参数");
                break;
        }

    }

    @Test
    /*
    从键盘分别输入年、月、日，判断这一天是当年的第几天
     */
    public void test1() {
        int year = 2020;
        int month = 5;
        int day = 11;
        int days = day;
        switch(month){
            case 12:
                days += 30;
            case 11:
                days += 31;
            case 10:
                days += 30;
            case 9:
                days += 31;
            case 8:
                days += 31;
            case 7:
                days += 30;
            case 6:
                days += 31;
            case 5:
                days += 30;
            case 4:
                days += 31;
            case 3:
                if(year % 400 == 0||(year % 4 == 0&&year % 100 != 0)){
                    days += 28;
                }else{
                    days += 29;
                }
            case 2:
                days += 31;
//            case 1:
//                days = day;

        }
        System.out.println(year+"年"+month+"月"+day+"日"+"是今年的第"+days+"天");
    }

    @Test
    /*
    使用条件结构实现，如果用户名等于字符‘青’，密码等于数字‘123’，就输出“欢迎你，青”，否则就输出“对不起，
    你不是青”
     */
    public void test2(){
//        char name = '青';
//        int pass = 123;
//        if(name == '青'&&pass == 123){
//            System.out.println("欢迎你，青");
//        }else{
//            System.out.println("对不起");
//        }

    }

}
